package com.diaohw.module.metadata.obj.vo;

import com.diaohw.module.metadata.obj.Status;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 元数据信息 VO
 *
 * @author D-Hw
 * @since 2025-04-07
 */
@Data
@Accessors(chain = true)
@Schema(name = "MetaDO VO", description = "元数据信息 VO")
public class MetaVO implements Serializable {


    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * 主键ID
     */
    @Schema(description = "ID")
    private String id;

    /**
     * 名称
     */
    @Schema(description = "名称")
    private String name;

    /**
     * 代码
     */
    @Schema(description = "代码")
    private String code;

    /**
     * 别名
     */
    @Schema(description = "别名")
    private String alias;

    /**
     * 状态
     */
    @Schema(description = "状态")
    private Status status;

    /**
     * 版本号
     */
    @Schema(description = "版本号")
    private String version;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;


    @Schema(description = "配置项")
    private List<MetaItemVO> items;

    public void pushItem(MetaItemVO item) {
        List<MetaItemVO> items = new ArrayList<>(this.items);
        items.add(item);
        this.items = items;
    }
}
